<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        img{
            width: 100px;
        }
        .active{
            border: 1px solid red;
        }
    </style>
</head>

<body>
    <div id="app">
        <!--v-bind设置元素的属性,比如:src,title,class等-->
        <img v-bind:src="imgSrc" alt="">
        <img :src="imgSrc" alt="" :title="imgTitle+'!!!'">
        <img :src="imgSrc" alt="" :class="isActive?'active':''">
        <!--需要动态的增删class建议使用对象的方式-->
        <img :src="imgSrc" alt="" :class="{active:isActive}" @click="toggleActive">
    </div>
    <!-- 开发环境版本，包含了有帮助的命令行警告 -->
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script>
        let v = new Vue({
            el:"#app",
            data:{
                imgSrc:"迷彩装.jpg",
                imgTitle:"周姣",
                isActive:false,
            },
            methods:{
                toggleActive(){
                    this.isActive = !this.isActive;
                }
            }
        })
    </script>
</body>

</html>